/*
 * Parser for initial conditions. 
 * 
 * TODO: add HFD5 and Python integration.
 */

  #include <stdlib.h>
  #include <stdio.h>
  #include <math.h>
  
  #include <common.h>
 
  int parse_ic_file( FILE* stream, SIM_DATA *s ) {
  
    if( stream == NULL ) {
      fprintf( stderr, "ERROR. CANNOT PARSE INITIAL CONDITIONS FILE. ABORTING.\n" );
      return -3;
    }
    
    int i,j;
    long Np = s->N;
  
    for( j=0; j<Np; j++ )
    {       
      fscanf( stream, "%lf %lf %lf %lf %lf %lf %lf\n", 
			 
			 &s->   X[4*j+3]  , //Mass
             &s->   X[4*j+0],&s->   X[4*j+1],&s->   X[4*j+2] , //X Y Z coordinates
             &s->XDOT[4*j+0],&s->XDOT[4*j+1],&s->XDOT[4*j+2]  ); //VX VY VZ coordinates
      
    }
         
    return 0;
  }
  
